<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
    <div>
        用户名<input type="username">
        <button>test</button>
    </div>
   <script>
       let nameEle = document.querySelector('.username')
       nameEle.onblur={
           set()
       }
       function set(){
        //    const setStorage = ('form')
           let data ={
               username : nameEle.value
           }
           setStorage('form',data)
       }
       
   </script> 
</body>
</html>